#ifndef CRYPT_H_INCLUDED
#define CRYPT_H_INCLUDED


/**********************************************************
   TEA  -  Tiny  Encryption  Algorithm
   Feistel  cipher  by  David  Wheeler  &  Roger  M.  Needham
   (extended  version)
 **********************************************************/

#define  ROUNDS  32
#define  DELTA  0x9e3779b9  /*  sqr(5)-1  *  2^31  */

#ifndef K0
    #define K0 840325
#endif

#ifndef K1
    #define K1 810225
#endif

#ifndef K2
    #define K2 'w'
#endif

#ifndef K3
    #define K3 'l'
#endif


/**********************************************************
   Input  values:  k[4] 128-bit  key
v[2]     64-bit  plaintext  block
   Output  values: v[2]     64-bit  ciphertext  block
 **********************************************************/

class Crypt
{
    public:
        Crypt();
        wxString enc(wxString s);
        wxString dec(wxString s);
    private:
        long k[4];
        void tean(long *v, long N);
        void cl_enc_block(long  *v);
        void cl_dec_block(long  *v);
};



#endif // CRYPT_H_INCLUDED
